package com.mop.app.common.exception;

import com.mop.app.common.enums.AppBizEnums;

public class Message {
    private String code = "0000";
    private String msg = "";
    private Object data;

    public Message() {
    }

    public Message(AppBizEnums AppBizEnums) {
        this.code = AppBizEnums.getCode();
        this.msg = AppBizEnums.getDesc();
    }

    public Message(String code) {
        this.code = code;
    }

    public Message(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Message(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Message error() {
        return new Message(AppBizEnums.ERROR);
    }

    public static Message error(AppBizEnums AppBizEnums) {
        return new Message(AppBizEnums);
    }

    public static Message error(String code) {
        return new Message(code);
    }

    public static Message error(String code, String msg) {
        return new Message(code, msg);
    }

    public static Message success() {
        return new Message(AppBizEnums.SUCCESS);
    }

    public static Message success(Object data) {
        Message message = new Message();
        message.setCode(AppBizEnums.SUCCESS.getCode());
        message.setMsg(AppBizEnums.SUCCESS.getDesc());
        message.setData(data);
        return message;
    }

    public static Message info(String code) {
        return new Message(code);
    }

    public static Message info(String code, String msg) {
        return new Message(code, msg);
    }

    public static Message info(String code, String msg, Object data) {
        return new Message(code, msg, data);
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
